#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<vector>
using namespace std;
class Solution {
public:
    int singleNumber(vector<int>& nums) {
        int ans = 0;
        for (int i = 0; i < 32; i++)
        {
            int total = 0;
            for (auto e : nums)
            {
                total += (e >> i) & 1;
            }

            ans |= (total % 3)<<i;
        }
        return ans;
    }
};